//package com.qunchuang.netty;
//
//import io.netty.buffer.ByteBuf;
//import io.netty.buffer.ByteBufUtil;
//import io.netty.buffer.Unpooled;
//import io.netty.channel.Channel;
//import io.netty.channel.ChannelFuture;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//import static com.qunchuang.netty.Client.CHANNEL;
//@Slf4j
//@Component
//public class TimingSelectLiftState {
//    @Scheduled(cron="0/20 * *  * * ? ")   //每20秒执行一次
//    private void timingSelectLiftState(){
//        for (String liftId : CHANNEL.keySet()) {
//            ChannelFuture channelFuture = CHANNEL.get(liftId);
//            Channel channel = channelFuture.channel();
//            ByteBuf buffer = Unpooled.buffer(10);
//            buffer.writeByte(0xaa);
//            buffer.writeByte(0x09);
//            buffer.writeByte(0x00);
//            buffer.writeByte(0x00);
//            buffer.writeByte(0x40);
//            buffer.writeByte(0x00);
//            buffer.writeByte(0x00);
//            buffer.writeByte(0x00);
//            buffer.writeByte(0x49);
//            buffer.writeByte(0xbb);
//            String s = ByteBufUtil.hexDump(buffer);
//            log.info("定时执行当前电梯：{}，定时10秒查询一次，查询电梯指令：{}",liftId,s);
//            channel.writeAndFlush(buffer);
//        }
//    }
//}
